Add warning for intervening audits on distribution edit #4026
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per discussion in Slack about the confusion around distribution edits.
The assumption when editing a distribution is that it actually represents movement of goods - in other words, the distribution was set up, but when it actually happens, the things that move around are different (e.g. the partner asks for more things or doesn't want as much).
If this isn't the case - if the person editing actually means to correct an administrative error - this can cause inventory issues if there was an intervening audit. The audit forces the inventory quantity to a particular amount, and editing the inventory will actually do a diff of the current and previous values and increase/decrease by that amount. This makes sense if it represents movement of goods, but not if it represents fixing an error.
This PR adds a warning when editing a distribution with an intervening audit indicating that inventory might be messed up in this case, and asking them to adjust it after the fact.
How Has This Been Tested?
Local and unit testing.
Screenshots